//package cn.tth.test.rabbitmq;
//
//import com.alibaba.fastjson.JSON;
//import com.rabbitmq.client.Channel;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.ExchangeTypes;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.rabbit.annotation.Exchange;
//import org.springframework.amqp.rabbit.annotation.Queue;
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.stereotype.Component;
//
//import java.io.IOException;
//
//@Slf4j
//@Component
//public class QueueCollection {
//
//    /**
//     * 死信队列
//     * @param channel
//     * @param message
//     * @throws IOException
//     */
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(
//                    value = MqConfig.死信队列Queue
//            ),
//            exchange = @Exchange(
//                    value = MqConfig.死信队列交换机,
//                    type = ExchangeTypes.TOPIC
//            ),
//            key = MqConfig.死信队列BindingKey
//    ))
//    public void declareListener(Channel channel, Message message) throws IOException {
//        log.info("死信队列----------------------");
//        try {
//            log.info((String) JSON.parse(message.getBody()));
//        } catch (Exception e){
//            log.warn("",e);
//        }finally {
//            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
//        }
//    }
//
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(
//                    value = MqConfig.生产者Queue_1
//            ),
//            exchange = @Exchange(
//                    value = MqConfig.生产者Exchange,
//                    type = ExchangeTypes.TOPIC
//            ),
//            key = MqConfig.生产者RoutingKey_1
//    ))
//    public void Listener(Channel channel, Message message) throws IOException {
//        try {
//            log.info("普通----------------------");
//        } catch (Exception e){
//            log.warn("",e);
//        }finally {
//            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
//        }
//    }
//
//}
